import { defineStore } from 'pinia'

export const useAuthStore = defineStore('auth', {
	state: () => ({
		activeTab: 'login-form', // 
		registeredAccount: {
			usernameOrPhone: '',
			password: ''
		}
	}),
	actions: {
		switchToLoginPage() {
			this.activeTab = 'login-form'
		},
		switchToRegisterPage(){
			this.activeTab = 'register-form'
		},
		autoLogin(username, password) {
			this.registeredAccount.usernameOrPhone = username
			this.registeredAccount.password = password
			this.switchToLoginPage()
		}
	}
})